///////////////////////////////////////////////////////////////////////////////
// Name:        linclass.h
// Purpose:     Linclass function
// Copyright:   (c) 2006, Ivan Laptev, TT Solutions
// License:     GPL, Please contact us for commercial license.
//              http://www.tt-solutions.com/
///////////////////////////////////////////////////////////////////////////////
#ifndef LINCLASS_H_
#define LINCLASS_H_

#include "objectdet/common.h"

//LINCLASS Linear classifier.
//
//Synopsis:
// [y,dfce] = linclass( X, model)
//
//Description:
// This function classifies input data X using linear
// discriminant function:
//
// y(i) = argmax W(:,y)'*X(:,i) + b(y)
//          y
//
// where parameters W [dim x nfun] and b [1 x nfun] are given 
// in model and nfun is number of discriminant functions.
//
// In the binary case (nfun=1) the classification rule is following
//   y(i) = 1 if W'*X(:,i) + b >= 0
//          2 if W'*X(:,i) + b < 0
// 
// where W [dim x 1], b [1x1] are parameters given in model.
//
//Input:
// X [dim x num_data] Data to be classified.
//
// model [struct] Parameters of linear classifier:
//  .W [dim x nfun] Linear term.
//  .b [nfun x 1] Bias.
//
//Output:
// y [1 x num_data] Predicted labels.
// dfce [nfun x num_data] Values of discriminat function.
//
//Examples:
// trn = load('riply_trn');
// tst = load('riply_tst');
// model = fld( trn );
// ypred = linclass( tst.X, model );
// cerror( ypred, tst.y )
// figure; ppatterns( trn ); pline( model );

// function [y,dfce]=linclass( X, model)
bool linclass(std::vector<double> const & feature, StageRule const & stagerule);

#endif

